<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>网络学生</title>
<script src="../js/global.js"></script>
<script type="text/javascript"
	src="../js/jquery-easyui-1.4.3/datagrid-export.js"></script>
<script type="text/javascript">
	$(function() {
		init();
	})
	function init() {
		$("#studentTab").datagrid({
			url : 'selectOnline',
			method : 'post',
			toolbar : "#tabBar",
			pagination : true,
			queryParams : {
				name : $("#name").val(),
				phone : $("#phone").val(),
				isValid : $("#isValid").combobox("getValue"),
				isReturnVist : $("#isReturnVist").combobox("getValue"),
				createTime : $("#createTime").datebox('getValue'),
				homeTime : $("#homeTime").datebox('getValue'),
				
				
			} 
		})
	}
	//导出excel
	/* function exportExcel() {
		$('#studentTab').datagrid('toExcel', 'gsy.xls'); // export to excel
	} */
	//导出Excel表
	function exportExcel(){
		var rows = $("#studentTab").datagrid("getSelections");
		if (rows.length == 0) {
			$.messager.alert("系统信息", "请选择导出的数据");
			return;
		}
		$("#win-daochu").window("open");
	}

	function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) {
		//如果jsondata不是对象，那么json.parse将分析对象中的json字符串。
		var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData)
				: JSONData;
		var CSV = '';
		//在第一行拼接标题
		CSV += ReportTitle + '\r\n\n';
		//产生数据标头
		if (ShowLabel) {
			var row = "";
			//此循环将从数组的第一个索引中提取标签
			for ( var index in arrData[0]) {
				//现在将每个值转换为字符串和逗号分隔
				row += index + ',';
			}
			row = row.slice(0, -1);
			//添加带换行符的标签行
			CSV += row + '\r\n';
		}
		//第一个循环是提取每一行
		for (var i = 0; i < arrData.length; i++) {
			var row = "";
			//第二个循环将提取每个列并将其转换为以逗号分隔的字符串
			for ( var index in arrData[i]) {
				row += '"' + arrData[i][index] + '",';
			}
			row.slice(0, row.length - 1);
			//每行后添加换行符
			CSV += row + '\r\n';
		}

		if (CSV == '') {
			alert("Invalid data");
			return;
		}

		var uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURI(CSV);
		var link = document.createElement("a");
		link.href = uri;
		link.style = "visibility:hidden";
		link.download = ReportTitle + ".csv";
		document.body.appendChild(link);
		link.click();
		document.body.removeChild(link);
	}

	function bgdaochu() {
		alert(2)
		var rows = $("#studentTab").datagrid("getSelections");
		var ches = $("#daochu-checkbox :checkbox");//要导出显示的列
		var datarows = [];//空数组
		var row = {};//空json对象
		for (var i = 0; i < rows.length; i++) {
			for (var k = 0; k < ches.length; k++) {
				var na = ches[k].name;//name:字段名
				var isOk = ches[k].checked;
				if(isOk && na == "id"){row.学生Id = rows[i].id;}
				if(isOk && na == "name"){row.姓名 = rows[i].name;}
				if(isOk && na == "ziXunName"){row.咨询师姓名 = rows[i].users.loginName;}
				if(isOk && na == "sex"){row.性别 = rows[i].sex.value==1? "男":"女";}
				if(isOk && na == "age"){row.年龄 = rows[i].age}
				if(isOk && na == "phone"){row.电话 = rows[i].phone;}
				if(isOk && na == "status"){row.学历 = rows[i].status;}
				if(isOk && na == "state"){row.状态 = rows[i].state.value == 1 ? "状态无" : "状态有";}
				if(isOk && na == "address"){row.地址 = rows[i].address;}
				if(isOk && na == "qq"){row.QQ = rows[i].qq;}
				if(isOk && na == "formPart"){row.来源部门 = rows[i].formPart;}
				if(isOk && na == "isValid"){row.是否有效 = rows[i].value == 1 ? "有效" : "无效";}
				if(isOk && na == "isReturnVist"){row.是否回访 = rows[i].isReturnVist.value == 1 ? "已回访" : "未回访";}
				if(isOk && na == "isHome"){row.是否上门 = rows[i].isHome.value == 1 ? "已上门" : "未上门";}
				if(isOk && na == "homeTime"){row.上门时间 = rows[i].homeTime;}
			}
			datarows[i] = row;
			row = {};
		}
		var data = JSON.stringify(datarows);//转换数据为json
		var title = $("#daochu-title").textbox("getValue");//获取标题
		alert(title);
		if(title!=null && title!=''){
			JSONToCSVConvertor(data, title , true);
			$("#win-daochu").window("close");
		}else{
			$.messager.alert("系统信息", "请填写Excel标题");
		}
	}
	function formatterSex(value,row,index){
		return value == 1 ? "男" : "女";
	}
	
	function formatterstate(value,row,index){
		return value == 1 ? "状态无" : "状态有";
	}
	function formatterisValid(value,row,index){
		return value == 1 ? "有效" : "无效";
	}
	function formatterisReturnVist(value,row,index){
		return value == 1 ? "已跟踪" : "未跟踪";
	}
	function formatterisHome(value,row,index){
		return value == 0 ? "已上门" : "未上门";
	}
	function formattercaozuo(value, row, index) {
		return "  <a href='javascript:void(0)' onclick='genzong("+ index + ")'>跟踪</a>  <a href='javascript:void(0)' onclick='upYouXiao("
			+ index + ")'>失效</a> <a href='javascript:void(0)' onclick='edit(" + index
			+ ")'>编辑</a>   <a href='javascript:void(0)' onclick='chakan("
			+ index + ")'>查看</a> <a href='javascript:void(0)' onclick='lookhf(" + index
			+ ")'>跟踪日志</a>";
	}
	/* 跟踪 */
	function genzong(index) {
		$("#genzongDialog").dialog("open");
		var arr = $("#studentTab").datagrid("getData");
		var row = arr.rows[index];
		$("#genzong-frms").form("load", row);
		alert(row.id)
		alert(row.usersId)
		
		$("#GZid").numberbox("setValue", row.id);
		$("#GZusersId").numberbox("setValue", row.usersId); 
		$("#genzongDialog").window("setTitle", "正在对" + row.name + "添加跟踪");
		/* $("#name12").textbox("setValue", row.name); */

	}
	/* 提交跟踪 */
	function follerSubmit() {
		alert($("#GZid").val())
		$.post("getgenzong", {
			studentId : $("#GZid").val(),
			userId : $("#GZusersId").val(),  
			/* name : $("#name").val(),  */
			followType : $("#followType").combobox("getValue"),
			content : $("#content").val(),
			followTime : $("#followTime").val(),
			followState : $("#followState").combobox("getValue")

		}, function(res) {
			if (res > 0) {
				/* $("#tabStu").datagrid("reload");  */
				$("#genzongDialog").dialog("close");
				$.messager.alert("提示", "跟踪成功")
			} else {
				$.messager.alert("提示", "跟踪失败")
			}
		}, "json")
	}

	/* 关闭跟踪 */
	function follerClose() {
		$("#genzongDialog").dialog("close");
	}
	function formatterUsers(value,row,index){
		if(value!=null){
			return value.loginName;
		}
	}
	
	/* 修改是否有效 */
	function upYouXiao(index) {
		
		
		var datas = $("#studentTab").datagrid("getData");
		var row = datas.rows[index];
		if(row.isValid==1){
			$.messager.confirm('确认失效', '您确认想要失效'+row.name+'学生吗？', function(r) {
				if (r) {
					$.post("upIsvaild", {
						id : row.id
					}, function(res) {
						if (res > 0) {
							$('#studentTab').datagrid('reload');
							$.messager.alert('提示', '失效成功！！！');
						}
					}, "json")
				}
			});
		}else{
			$.messager.alert('提示', '不能进行二次失效！！！');

		}
		
	}
	
	//查看
	function chakan(index) {
			var data = $("#studentTab").datagrid("getData");
			var row = data.rows[index];
			$("#chakan-frm").form("load", row);
			$("#chakan-dialog").dialog("open");
		}
	//编辑
	function edit(index) {
			var data = $("#studentTab").datagrid("getData");
			var row = data.rows[index];
			$("#edit-frm").form("load", row);
			$("#edit-dialog").dialog("open");
		}
		
	function updateStu() {
		$.post("updateStu", {
			id : $("#updateid").val(),
			name : $("#updatename").val(),
			sex : $("#updatesex").combobox("getValue"),
			age : $("#updateage").val(),
			phone : $("#updatephone").val(),
			status : $("#updatestatus").val(),
			state : $("#updatestate").combobox("getValue"),
			address : $("#updateaddress").val(),
			learnForward : $("#updatelearnForward").val(),
			qq : $("#updateqq").val(),
			ziXunName : $("#updateziXunName").val(),
		
		}, function(res) {
			if (res > 0) {
				$("#studentTab").datagrid("reload");
				$("#edit-dialog").dialog("close");
				$.messager.alert("提示", "修改成功")
			} else {
				$.messager.alert("提示", "修改失败")
			}
		}, "json")
	}

	function updateClear() {
		$("#edit-dialog").dialog("close");
	}
	
	//打开设置隐藏列对话框
	function selectColumn() {
		$("#hiddenColumn_dialog").dialog("open");
	}
	function saveColumn() {
			var cbx = $("#hiddenColumn_form input[type='checkbox']"); //获取Form里面是checkbox的Object
		    var checkedValue = "";
		    var unCheckValue = "";
		    for (var i = 0; i < cbx.length; i++) {
		        if (cbx[i].checked) {//获取已经checked的Object
		            if (checkedValue.length > 0) {
		                checkedValue += "," + cbx[i].value; //获取已经checked的value
		            }
		            else {
		                checkedValue = cbx[i].value;
		            }
		        }
		        if (!cbx[i].checked) {//获取没有checked的Object
		            if (unCheckValue.length > 0) {
		                unCheckValue += "," + cbx[i].value; //获取没有checked的value
		            }
		            else {
		                unCheckValue = cbx[i].value;
		            }
		        }
		    }
		    var checkeds = new Array();
		    if (checkedValue != null && checkedValue != "") {
		        checkeds = checkedValue.split(',');
		        for (var i = 0; i < checkeds.length; i++) {
		            $('#studentTab').datagrid('showColumn', checkeds[i]); //显示相应的列
		        }
		    }
		    var unChecks = new Array();
		    if (unCheckValue != null && unCheckValue != "") {
		        unChecks = unCheckValue.split(',');
		        for (var i = 0; i < unChecks.length; i++) {
		            $('#studentTab').datagrid('hideColumn', unChecks[i]); //隐藏相应的列
		        }
		    } 
		    $('#hiddenColumn_dialog').dialog('close');
		}
	//关闭设置隐藏列弹框
	function closed_hiddenColumn() {
		$('#hiddenColumn_dialog').dialog('close');
	}
	//全选按钮
	function ChooseAll() {
	   
	    var a=$("#isQuanXuan").text();//获取按钮的值
	    if("全选"==a.trim()){
	    	 $("#hiddenColumn_form input[type='checkbox']").prop("checked", true);//全选
	    	$('#isQuanXuan').linkbutton({ text:'全不选' });
	    }else{    	
	    	 $("#hiddenColumn_form input[type='checkbox']").removeAttr("checked", "checked");//取消全选
	    	 $('#isQuanXuan').linkbutton({ text:'全选' });
	    }
	    
	}
	
	//自定义验证
    $.extend($.fn.validatebox.defaults.rules, {
    phoneRex:{
        validator: function(value){
        var rex=/^1[3-8]+\d{9}$/;
        var rex2=/^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
        if(rex.test(value)||rex2.test(value))
        {
          return true;
        }else
        {
           return false;
        }
        },
        message: '请输入正确电话或手机格式'
    },
    qq: {// 验证QQ
        validator: function (value) {
            return /^[1-9]\d{4,9}$/i.test(value);
        },
        message: 'QQ号码格式不正确'
    },
    age: {// 验证年龄
        validator: function (value) {
            return /^(?:[1-9][0-9]?|1[01][0-9]|120)$/i.test(value);
        },
        message: '年龄必须是0到120之间的整数'
    }
});	
    /* 新建学员窗口 */
	function addStu() {
		$("#add-dialog").dialog("open");
	}
	/* 学员窗口取消 */
	function clearStu() {
		$("#add-dialog").dialog("close");
	}
	/* 添加新学生 */
	function bcStu() {
		var re = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
		var TEL_REGEXP = /^1([38]\d|5[0-35-9]|7[3678])\d{8}$/;
		alert($("#addname").val())
		alert($("#addisReturnVist").combobox("getValue"))
		if (re.test($("#addqq").val())) {
			if (TEL_REGEXP.test($("#addphone").val())) {
				$.post("addOnlineStu", {
					/* usersId : $("#addusersId").val(), */
					name : $("#addname").val(),
					sex : $("#addsex").combobox("getValue"),
					age : $("#addage").val(),
					phone : $("#addphone").val(),
					status : $("#addstatus").val(),
					state : $("#addstate").combobox("getValue"),
					address : $("#addaddress").val(),
					qq : $("#addqq").val(),
					learnForward : $("#addlearnForward").val(),
					isValid : $("#addisValid").combobox("getValue"),
					isReturnVist : $("#addisReturnVist").combobox("getValue"),
					isHome : $("#addisHome").combobox("getValue"),
					homeTime : $("#addhomeTime").datetimebox("getValue"),
					
				}, function(res) {
					if (res > 0) {
						$("#studentTab").datagrid("reload");
						$("#add-dialog").dialog("close");
						$.messager.alert("提示", "新增成功")
					} else {
						$.messager.alert("提示", "新增失败")
					}
				}, "json")
			} else {
				$.messager.alert("提示", "手机格式不正确！！！")
			}
		}/*  else {
			$.messager.alert("提示", "邮箱格式不正确！！！")
		} */

	}

	
	function formatterZName(value, row, index) {
		 return value.loginName;
	} 
		function formatterXName(value, row, index) {
			 if(value!=null){
				 return value.name;
				}
			 
		}
		//跟踪日志

		function lookhf(index){
			var arr=$("#studentTab").datagrid("getData");
			var row=arr.rows[index];
		
			$("#HiufangTab").datagrid({
				url : 'lookHiuFang',
				method : 'post',
				pagination : true,
				singleSelect : true
				,
				queryParams:{
					sid:row.id
				}
			})
			$("#lookhuifang").dialog("open");
		}
	

</script>
</head>
<body>
	<table id="studentTab" class="easyui-datagrid">
		<thead>
			<tr>
			  <th data-options="field:'asd',checkbox:'true'"></th> 
				<th data-options="field:'id',title:'学生id'"></th>
				<th data-options="field:'createTime',title:'创建时间'"></th>
				<th data-options="field:'name',title:'学员姓名'"></th>
				<th data-options="field:'users',title:'咨询师姓名',formatter:formatterUsers,hidden:true"></th>
				<th data-options="field:'sex',title:'性别',formatter:formatterSex"></th>
				<th data-options="field:'age',title:'年龄'"></th>
				<th data-options="field:'phone',title:'学员电话'"></th>
				<th data-options="field:'status',title:'学历'"></th>
				<th data-options="field:'state',title:'个人状态',formatter:formatterstate"></th>
				<th data-options="field:'address',title:'所在地域'"></th>
				<th data-options="field:'qq',title:'学院QQ'"></th>
				<th data-options="field:'formPart',title:'来源部门'"></th>
				<th data-options="field:'isValid',title:'是否有效',formatter:formatterisValid"></th>
				<th data-options="field:'isReturnVist',title:'是否回访',formatter:formatterisReturnVist"></th>
				<th data-options="field:'isHome',title:'是否上门',formatter:formatterisHome"></th>
				<th data-options="field:'homeTime',title:'上门时间'"></th>
                <th data-options="field:'formattercaozuo',title:'操作',formatter:formattercaozuo"></th>

		</thead>
	</table>
	<div id="tabBar">
	名称:<input type="text" class="easyui-textbox" id="name" /> 电话：<input
			class="easyui-textbox" type="text" id="phone"> 创建时间：<input
			type="text" class="easyui-datebox" id="createTime"> 上门时间：<input
			type="text" class="easyui-datebox" id="homeTime">  
		</select> 是否有效：<select id="isValid" class="easyui-combobox" name="是否有效">
			<option value=" ">---请选择---</option>
			<option value="1">有效</option>
			<option value="2">无效</option>
		</select> 是否回访：<select id="isReturnVist" class="easyui-combobox" name="是否回访">
			<option value=" ">---请选择---</option>
			<option value="1">已回访</option>
			<option value="2">未回访</option>
		</select>
		<a href="javascript:void(0)"
			onclick="init()" class="easyui-linkbutton"
			data-options="iconCls:'icon-search'">搜索</a> 
		<a class="easyui-linkbutton" onclick="exportExcel()" id="serach" 
			data-options="iconCls:'icon-print'">导出excel</a>
		<a href="javascript:void(0)" onclick="addStu()"
			class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
			<a
					class="easyui-linkbutton" onclick="selectColumn()"
					id="serach" data-options="iconCls:'icon-print'">显示隐藏</a>
	</div>
	
	<!-- 添加跟踪信息 -->
	<div id="genzongDialog" class="easyui-dialog"
		data-options="modal:true,closed:true">
		<form id="genzong-frms" class="easyui-form" title="跟踪的窗口">
			<table>
				<tr>
					<!-- <td><label for="name"></label></td> -->
					<td><input class="easyui-numberbox" type="hidden" id="GZid" 
						name="id" data-options="required:true" disabled="disabled"/></td>
				</tr>
				
				 <tr>
					<!-- <td><label for="name"></label></td> -->
					<td><input class="easyui-numberbox" type="hidden" id="GZusersId"
						name="usersId" data-options="required:true" disabled="disabled"/></td>
				</tr> 
				
				<!-- <tr>
					<td><label for="name">id:</label></td>
					<td><input class="easyui-numberbox" type="text" id="GZUid"
						name="id" data-options="required:true" /></td>
				</tr> -->
				<!-- <tr>
					<td><label for="name">学生姓名:</label></td>
					<td><input class="easyui-textbox" type="text" id="name12"
						name="name" data-options="required:true" /></td>
				</tr> -->
				<tr>
					<td><label for="name">跟踪方式:</label></td>
					<td><select id="followType" class="easyui-combobox">
							<option value="">---请选择---</option>
							<option value="跟踪">跟踪</option>
							<option value="网络">网络</option>
					</select></td>
				</tr>


				<tr>
					<td><label for="name">内容:</label></td>
					<td><input class="easyui-validatebox" type="text" id="content"
						data-options="required:true" /></td>
				</tr>
				 <tr>
					<td><label for="name">跟踪时间:</label></td>
					<td><input class="easyui-datebox" type="text"
						id="followTime" data-options="required:true" /></td>
				</tr> 
				<!-- <tr>
					<td><label for="name">回访情况:</label></td>
					<td><input class="easyui-validatebox" type="text"
						id="followState" data-options="required:true" /></td>
				</tr> -->

				<tr>
					<td><label for="name">跟踪情况:</label></td>
					<td><select id="followState" class="easyui-combobox">
							<option value="">---请选择---</option>
							<option value="已跟踪">已跟踪</option>
							<option value="未跟踪">未跟踪</option>
					</select></td>
				</tr>


				<tr>
					<td><a href="javascript:void(0)" class="easyui-linkbutton"
						onclick="follerSubmit()">提交</a></td>
					<td><a href="javascript:void(0)" class="easyui-linkbutton"
						onclick="follerClose()">取消</a></td>
				</tr>
			</table>
		</form>

	</div>
	
	
	<!-- 查看   -->
	<div id="chakan-dialog" class="easyui-dialog"
		style="width: 600px; height: 300px"
		data-options="title:'学员信息窗口',modal:true,closed:true,
					buttons:[{
						text:'关闭',
						handler:function(){closeStu()}
					}]">
		<form id="chakan-frm">
			<table>
				<thead>
					<tr>
						<td><label for="name">创建时间:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="createTime" disabled="disabled"/></td>
					</tr>
					<tr>
						<td><label for="name">学员姓名:</label></td>
						<td><input class="easyui-validatebox" type="text" name="name" disabled="disabled"/>
						</td>
					</tr>
					<tr>
						<td><label for="name">学员电话:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="phone" disabled="disabled"/></td>
					</tr>
					
					
					<tr>
						<td><label for="name">性别:</label></td>
						<td><select id="sex" name="sex"  class="easyui-combobox" disabled="disabled">
								<option value="1">男</option>
								<option value="2">女</option>
						</select></td>
					</tr>
					
					
					<tr>
						<td><label for="name">年龄:</label></td>
						<td><input class="easyui-validatebox" type="text" name="age" disabled="disabled"/>
						</td>
					</tr>
					<tr>
						<td><label for="name">学历:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="status" disabled="disabled"/></td>
					</tr>
					
					<tr>
						<td><label for="name">状态:</label></td>
						<td><select id="state" name="state" class="easyui-combobox" disabled="disabled">
								<option value="2">有状态</option>
								<option value="1">无状态</option>
						</select></td>
					</tr>
					
				
					<tr>
						<td><label for="name">学员QQ:</label></td>
						<td><input class="easyui-validatebox" type="text" name="qq" disabled="disabled"/>
						</td>
					</tr>
					<tr>
						<td><label for="name">来源部门:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="learnForward" disabled="disabled"/></td>
					</tr>
					<tr>
						<td><label for="name">是否有效:</label></td>
						<td><select id="isValid" name="isValid" class="easyui-combobox" disabled="disabled">
								<option value="1">有效</option>
								<option value="2">无效</option>
						</select></td>
					</tr>
					<tr>
						<td><label for="name">是否上门:</label></td>
						<td><select id="isHome" name="isHome" class="easyui-combobox" disabled="disabled">
								<option value="1">已上门</option>
								<option value="2">未上门</option>
						</select></td>
					</tr>
					<tr>
						<td><label for="name">上门时间:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="homeTime" disabled="disabled"/></td>
					</tr>
				
					
				</thead>
			</table>
		</form>
	</div>
	
	
	
	
	<!-- 修改 -->
	<div id="edit-dialog" class="easyui-dialog"
		style="width: 600px; height: 300px"
		data-options="title:'我的对话框',modal:true,closed:true,
					buttons:[{
						text:'保存',
						handler:function(){updateStu()}
					},{
						text:'关闭',
						handler:function(){updateClear()}
					}]">
		<form id="edit-frm">
			<table>
				<thead>
					<tr>
						<td><label for="name">编号:</label></td>
						<td><input class="easyui-validatebox" type="text" name="id"
							id="updateid" /></td>
					</tr>
					<tr>
						<td><label for="name">姓名:</label></td>
						<td><input class="easyui-validatebox" type="text" name="name"
						 	id="updatename" /></td>
					</tr>
					
					
					 <tr>
							<td>
								<label for="name">性别:</label>
							</td>
							<td>
								<select id="updatesex" name="sex" class="easyui-combobox">   
								    <option value="1">男</option>   
								    <option value="2">女</option>   
								</select>
							</td>
						</tr>


					<tr>
						<td><label for="name">年龄:</label></td>
						<td><input class="easyui-validatebox textbox" data-options="validType:'age'" type="text" name="age"
							id="updateage" /></td>
					</tr>
					<tr>
						<td><label for="name">电话:</label></td>
						<td><input class="easyui-validatebox textbox" data-options="validType:'phoneRex'" type="text"
							name="phone" id="updatephone" /></td>
					</tr>
					<tr>
						<td><label for="name">学历:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="status" id="updatestatus" /></td>
					</tr>
					
					 <tr>
							<td>
								<label for="name">状态:</label>
							</td>
							<td>
								<select id="updatestate" name="updatesex" class="easyui-combobox">   
								    <option value="1">有状态</option>   
								    <option value="2">无状态</option>   
								</select>
							</td>
						</tr>
				
				
				
				
				
					<tr>
						<td><label for="name">来源部门:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="learnForward" id="updatelearnForward" /></td>
					</tr>
					<tr>
						<td><label for="name">学员QQ:</label></td>
						<td><input class="easyui-validatebox textbox" data-options="validType:'qq'" type="text" name="qq"
							id="updateqq" /></td>
					</tr>
				
					
				
					
					<tr>
						<td><label for="name">咨询师:</label></td>
						<td><input class="easyui-validatebox" type="text"
							name="ziXunName" id="updateziXunName" /></td>
					</tr>
				

				</thead>
			</table>
		</form>
	</div>
	
	
	
	<!--  显示列-->
		
		<div id="hiddenColumn_dialog" class="easyui-dialog" data-options="title:'设置显示列',modal:true,closed:'true',
			buttons:[{
				text:'保存',
				handler:function(){
				saveColumn();<!-- 保存 -->
				init();<!-- 刷新 -->
				closed_hiddenColumn();<!-- 关闭弹窗 -->
				}
			},{
				text:'关闭',
				handler:function(){
				closed_hiddenColumn();
				}
			}]">
		<form id="hiddenColumn_form" class="easyui-form">
		<a href="javascript:void()"  class="easyui-linkbutton" id="isQuanXuan" onclick="ChooseAll()" data-options="iconCls:'icon-edit'">全选</a>
			<table>
				<tr>
					<td><input type="checkbox" value="createTime"/>创建时间</td>
					<td><input type="checkbox" value="id"/>学生id</td>
				
					<td><input type="checkbox" value="name"/>学员姓名</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="users"/>咨询师姓名</td>
						
					<td><input type="checkbox" value="sex"/>性别</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="age"/>年龄</td>
			
					<td><input type="checkbox" value="phone"/>学员电话</td>
				</tr>
				
				
				
				<tr>
					<td><input type="checkbox" value="status"/>学历</td>
				
					<td><input type="checkbox" value="state"/>个人状态</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="address"/>所在区域</td>
				
					<td><input type="checkbox" value="qq"/>学院QQ</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="formPart"/>来源部门</td>
				
					<td><input type="checkbox" value="isValid"/>是否有效</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="isReturnVist"/>是否回访</td>
				
					<td><input type="checkbox" value="isHome"/>是否上门</td>
				</tr>
				<tr>
					<td><input type="checkbox" value="homeTime"/>上门时间</td>
					 <td><input type="checkbox" value="caozuo"/>操作</td>
				</tr>
				
			</table>
		</form> 
	</div> 
	<%-- 导出EXCel窗口 --%>
	<div id="win-daochu" class="easyui-window"
		data-options="iconCls:'icon-save',closed:true,width:600,height:380,modal:true"
		title="导出Excel">
		 <table id="tab-daochu" cellpadding="10" >
			<tr>														
				<td>
					<label for="content">填写表名:</label>
               		<input class="easyui-textbox" type="text" id="daochu-title" style="width:200px">
				</td>
			</tr>
			<tr>														
				<td>
					<h3>选列:选择要显示的列</h3>
					<table id="daochu-checkbox" style="border:1px solid #000000;" cellpadding="15">
						<tr>
						<td><input type="checkbox" name="id" value="学生Id" checked="checked"/>学生Id</td>
							<td><input type="checkbox" name="name" value="姓名" checked="checked"/>姓名</td>
							<td><input type="checkbox" name="ziXunName" value="咨询师姓名" checked="checked"/>咨询师姓名</td>
							<td><input type="checkbox" name="sex" value="性别" checked="checked"/>年龄</td>
							<td><input type="checkbox" name="age" value="年龄" checked="checked"/>性别</td>
							<td><input type="checkbox" name="phone" value="电话" checked="checked" />咨询师姓名</td>
						</tr>
						<tr>
							<td><input type="checkbox" name="status" value="学历" checked="checked"/>电话</td>
							<td><input type="checkbox" name="state" value="状态" checked="checked"/>学历</td>
							<td><input type="checkbox" name="address" value="地址" checked="checked"/>地址</td>
							<td><input type="checkbox" name="qq" value="qq" checked="checked"/>QQ</td>
						</tr>
						<tr>
						<td><input type="checkbox" name="formPart" value="来源部门" checked="checked"/>来源部门</td>
						<td><input type="checkbox" name="isValid" value="是否有效" checked="checked"/>是否有效</td>
						<td><input type="checkbox" name="isReturnVist" value="是否回访" checked="checked"/>是否回访</td>
						<td><input type="checkbox" name="isHome" value="是否上门" checked="checked"/>是否上门</td>
						<td><input type="checkbox" name="homeTime" value="上门时间" checked="checked"/>上门时间</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>														
				<td>
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="bgdaochu()" data-options="iconCls:'icon-print'">确认导出Excel</a>    
				</td>
			</tr>
		</table> 
	</div> 
	
	
	<!-- 添加 -->
	<div id="add-dialog" class="easyui-dialog"
		style="width: 600px; height: 300px"
		data-options="title:'新建学员窗口',modal:true,closed:true,
					buttons:[{
						text:'保存',
						handler:function(){bcStu()}
					},{
						text:'关闭',
						handler:function(){clearStu()}
					}]">
		<form>
			<table>
				<thead>
                     <!-- <tr>
						<td><label for="name">用户编号:</label></td>
						<td><input class="easyui-validatebox" type="text"
							id="addusersId" /></td>
					</tr> 
					 -->
					<tr>
						<td><label for="name">姓名:</label></td>
						<td><input class="easyui-validatebox" type="text"
							id="addname" /></td>
					</tr>

					<tr>
						<td><label for="name">性别:</label></td>
						<td><select id="addsex" class="easyui-combobox">
								<option value="">---请选择---</option>
								<option value="1">男</option>
								<option value="2">女</option>
						</select></td>
					</tr>

					<tr>
						<td><label for="name">年龄:</label></td>
						<td><input class="easyui-validatebox" type="text" id="addage" />
						</td>
					</tr>

					<tr>
						<td><label for="name">电话:</label></td>
						<td><input class="easyui-validatebox" type="text"
							id="addphone" /></td>
					</tr>

					<tr>
						<td><label for="name">学历:</label></td>
						<td><input class="easyui-validatebox" type="text"
							id="addstatus" /></td>
					</tr>

					<tr>
						<td><label for="name">状态:</label></td>
						<td><select id="addstate" class="easyui-combobox">
								<option value=" ">---请选择---</option>
								<option value="2">有状态</option>
								<option value="1">无状态</option>
						</select></td>
					</tr>
                     <tr>
						<td><label for="name">所在地区:</label></td>
						<td><input class="easyui-validatebox" type="text" id="addaddress" />
						</td>
					</tr>
					
					<tr>
						<td><label for="name">学员QQ:</label></td>
						<td><input class="easyui-validatebox" type="text" id="addqq" />
						</td>
					</tr>
					<tr>
						<td><label for="name">来源部门:</label></td>
						<td><input class="easyui-validatebox" type="text" id="addlearnForward" />
						</td>
					</tr>
					<tr>
						<td><label for="name">是否有效:</label></td>
						<td><select id="addisValid" 
							class="easyui-combobox" >
								<option value="1">有效</option>
								<option value="2">无效</option>
						</select></td>
					</tr>
					<tr>
						<td><label for="name">是否回访:</label></td>
						<td><select id="addisReturnVist" 
							class="easyui-combobox" >
								<option value="1">已回访</option>
								<option value="2">未回访</option>
						</select></td>
					</tr>
                  <tr>
						<td><label for="name">是否上门:</label></td>
						<td><select id="addisHome"  class="easyui-combobox"
							>
								<option value="1">已上门</option>
								<option value="2">未上门</option>
						</select></td>
					</tr>
					<tr>
						<td><label for="name">上门时间:</label></td>
						<td><input class="easyui-datetimebox" type="text"
							id="addhomeTime"  /></td>
					</tr>


				</thead>
			</table>
		</form>
	</div>
	
	<div id="lookhuifang" class="easyui-dialog" title="跟踪日志" style="width:500px;height:450px;"
 data-options="modal:true,closed:true">
	<table id="HiufangTab" class="easyui-datagrid">
		<thead>
			<tr>
				<th data-options="field:'id',title:'跟踪者编号'"></th>
				<th data-options="field:'student',title:'姓名',formatter:formatterXName"></th>
				<th data-options="field:'users',title:'跟踪者',formatter:formatterZName,hidden:true"></th>
				<th data-options="field:'followTime',title:'跟踪时间'"></th>
				<th data-options="field:'followType',title:'跟踪方式'"></th>
				<th data-options="field:'content',title:'跟踪内容'"></th>
				<th
					data-options="field:'followState',title:'跟踪情况'"></th>
		</thead>
	</table>
	</div>
	
</body>
</html>




